import http from '../../http/index';

// 图片上传
export function uploadArticleCover(data) {
  return http({
    headers: { 'Content-Type': 'multipart/form-data' },
    url: '/upload/uploadArticleCover',
    method: 'post',
    data
  });
}

// 发布帖子
export function createPost(data) {
  return http({
    url: '/admin/createPost',
    method: 'post',
    data
  });
}

// 定时发布帖子
export function createSchedulePost(data) {
  return http({
    url: '/admin/createSchedulePost',
    method: 'post',
    data
  });
}

// 帖子详情
export const queryPostDetail = params => {
  return http({
    url: '/admin/queryPostDetail',
    method: 'get',
    params
  });
};

// 帖子详情
export const updatePost = (data, urlInfo) => {
  return http({
    url: urlInfo.url,
    method: 'post',
    data
  });
};
